<?php 

class AddDirForm extends My_Form
{
	public function __construct($iId = null) {
		$sBaseUrl = Zend_Registry::get('baseUrl');
		
		parent::__construct();
		
		$this->setAction($sBaseUrl.'/ftp/adddir')
				->setMethod('post');
		
		// Create and configure
		$idRodzica = $this->createElement('hidden', 'id_rodzica', array('value' => $iId));
		$idRodzica->setDecorators($this->hiddenDecorator);
		$idRodzica->setRequired(true)
					->addValidator('digits');	
					
		$nazwa = $this->createElement('text', 'nazwa');	
		$nazwa->setDecorators($this->textDecorator);
		$nazwa->setLabel("Nazwa: ");
		$nazwa->addValidator('regex', false, array('/^[a-z]+/'))
				->addValidator('stringLength', false, array(2, 20))
				->addFilter('StringToLower')
				->setRequired(true);
				
		$submit = $this->createElement('submit', 'submit', array('label' => 'Dodaj'));
		$submit->setDecorators($this->submitDecorator);
		// Add elements to this:
		$this->addElement($idRodzica)
				->addElement($nazwa)
				->addElement($submit);		
	}
}

?>
